﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Device.Location;
namespace UtilityApp
{
    public partial class MapPage : PhoneApplicationPage
    {
        public MapPage()
        {
            InitializeComponent();
        }
        GeoCoordinateWatcher gps;
        private void myMap_Loaded(object sender, RoutedEventArgs e)
        {
            myMap.ZoomLevel = 14.0;
            myMap.Center = new GeoCoordinate(13.743439, 100.537298);
            gps = new GeoCoordinateWatcher();
            gps.Start();
            gps.PositionChanged +=gps_PositionChanged;
            
        }

        void gps_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            myMap.Center = gps.Position.Location;
        }
    }
}